/**
 * @file rank/elementary/luogu1116/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/7 13:54:22
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 10010;
int a[N];
int main() {
  // High rating and good luck!
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int cnt = 0;
  for (int j = 0; j < n - 1; ++j) {
    for (int i = 0; i < n - j - 1; ++i) {
      if (a[i] > a[i + 1]) {
        swap(a[i], a[i + 1]);
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
